package com.craterhill.java.ccp.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.craterhill.java.ccp.common.beans.Course;
import com.craterhill.java.ccp.dao.impl.AbstractDao;
import com.craterhill.java.ccp.dao.utils.CCPResultSetExtractor;

public interface CoursesDao extends CCPDao<Course> {
	
	public final String FIELD_LIST = "obj.college_Id, obj.course_Name, obj.courses_Id" + AbstractDao.MONITER_FIELDS;
	public final String FIND_ALL_COURSES = " select " + FIELD_LIST + " from Courses obj ";

	public final class CoursesExtractor extends CCPResultSetExtractor<Course> {
		
		@Override
		protected Course extractResultSetData(ResultSet resultSet) throws SQLException {
			Course courses = new Course();
			courses.setCollegeId(resultSet.getInt(1));
			courses.setCourseName(resultSet.getString(2));
			courses.setCoursesId(resultSet.getInt(3));
			courses.setStatus(resultSet.getBoolean(4));
			courses.setCreatedBy(resultSet.getInt(5));
			courses.setModifiedBy(resultSet.getInt(6));
			courses.setCreatedDate(resultSet.getDate(7));
			courses.setModifiedDate(resultSet.getDate(8));
			return courses;

		}
	}

}
